package com.lzb.service;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.lzb.domain.MngUser;
import com.lzb.mapper.MngUserMapper;

@Service(MngUserService.BEAN_PACKAGE_NAME)
@Transactional(readOnly=true)
public class MngUserService {

	@Resource(name = "sqlSession")
	private SqlSession sqlSession;
	
	public static final String BEAN_PACKAGE_NAME = "com.lzb.service.MngUserService";
	
	@Transactional(isolation=Isolation.DEFAULT,propagation=Propagation.REQUIRED,readOnly=false)
	public void add(MngUser user) {
		try {
			MngUserMapper userMapper = sqlSession.getMapper(MngUserMapper.class);
			userMapper.insert(user);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
//	public MngUser getBenaById(Serializable id) {
//		try {
//			MngUserMapper userMapper = sqlSession.getMapper(MngUserMapper.class);
//		//	userMapper.insert(user);
//		} catch(Exception e) {
//			e.printStackTrace();
//		}
//	}
}
